<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
	<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
	<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
	<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
    
    
    <title>用户信息</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript" src="scripts/Myscripts/alpha_add.js"></script>
<script language="javascript" type="text/javascript">
		
		function checkusernick()
		{
			if(document.getElementById("user_nick").value=="")
				return false;
				else
				return true;		
		}
		function checkidcard()
		{
			var idcard=document.form1.id_card.value;
			var pattern=/^\d{15}$|^\d{18}&|^\d{17}[xX]$/;
			if(pattern.test(idcard)){
			return true;
			}
			else
			{
				alert("身份证非法");
				return false;
			}	
		}
		function checkcellphone()
		{
			var mobile=document.form1.cellphone.value;
			var pattern=/^\d{11}$/;
			if(pattern.test(mobile))
			{
				return true;
			}else{
				alert("移动电话非法");
				return false;
			}
		}
		
		function checktel(){
			var tel=document.form1.tel.value;
			var pattern=/^\d{3}-\d{8}|d{4}-\d{7}$/;
			if(pattern.test(tel))
			{
				return true;
			}else{
				alert("座机非法");
				return false;
			}
			}	
		
		function checkall()
		{
			if(checkusernick()&&checkidcard()&&checkcellphone())
			{ 
				alert("修改成功！");
				document.form1.action="servlet/Userqueryservlet?type=insert";
				document.form1.submit();
			}else
			{
				alert("用户信息修改未完成！");
			}
		}
</script>
  </head>
  
  <body>
  <form name="form1" method="post">
  <div id = "add_alpha_id">
  		<div id="container">	
		<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_border">
						<div id="box_top">基本信息</div>
							<div id="ui_tb" >
								<table class="table" width="100%">
								<tr><th>客户账号</th><th>客户姓名</th><th>身份证号 </th></tr>
								<tr>
									<td><label id="user_name">${u_name}</label></td>
									<input type="hidden" name="u_name" value="${u_name}"/>
									
									<td><input class="ui_input_txt02" id="user_nick" name="user_nick" value="${user_nick}" onblur="checkusernick()"></td>
									<td><input class="ui_input_txt02" id="id_card" name="id_card" value="${id_card}" onblur="checkidcard()"></td>
								</tr>
								<tr><th>单位名称</th><th>移动电话</th><th>座机</th></tr>
								<tr>	
									<td><input class="ui_input_txt02" id="company" name="company" value="${company}" ></td>
									<td><input class="ui_input_txt02" id="cellphone" name="cellphone" value="${cellphone}" onblur="checkcellphone()"></td>
									<td><input class="ui_input_txt02" id="tel" name="tel" value="${tel}"onblur="checktel()"></td>
								</tr>
								</table>
						</div>
						<div id="box_bottom">							
						</div>
					</div>
				</div>
			</div>	
			<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_border">
						<div id="box_top">订单信息</div>
							<div class="ui_text_indent">
								<table class="table" width="100%">
								<tr>
									<th>订单号 </th><th>商品名称</th><th>数量</th><th>单价</th><th>总额</th><th>订单状态</th>
								</tr>
								<c:forEach items="${orders}" var="temp">
							
								<tr>
									<td><label>${temp.order_id}</label></td>
									<td><label>${temp.product_name}</label></td>
									<td><label>${temp.product_number}</label></td>
									<td><label>${temp.product_price}</label></td>
									<td><label>${temp.total_price}</label></td>
									<td><label>${temp.order_state}</label></td>
								</tr>
								</c:forEach>
								
								<tr>
									<td colspan="2" align="center"><input type="button" class="ui_input_btn01" value="修改" onclick="checkall()"></td>
									<td colspan="2" align="center"><input type="reset" class="ui_input_btn01" value="重置" ></td>
									<td colspan="2" align="center"><input type="button" class="ui_input_btn01" value="返回" onclick="document.form1.action='user/Userquery.jsp';document.form1.submit()"/></td>
								</tr>
								
								
								</table>
						</div>
						<div id="box_bottom">							
						</div>
					</div>
				</div>
			</div>	
		</div>
		</div>
	</form>
	<script type="text/javascript">
    var eitem = document.getElementById("add_alpha_id");
    window.onload = add_alpha(eitem);
    </script>
  </body>
</html>
